import { InputItem, SelectItem } from '@/components/common-form/common-form-type';

const scaleNameCNItem: InputItem = {
  name: 'input',
  prop: 'nameCN',
  label: '中文名称',
  placeholder: '请输入量表中文名称',
  defaultValue: '',
  rules: [
    {
      required: true,
      message: '量表中文名称是必填项！',
      trigger: 'blur',
    },
  ],
};

const scaleNameENItem: InputItem = {
  name: 'input',
  prop: 'nameEN',
  label: '英文名称',
  placeholder: '请输入量表英文名称',
  defaultValue: '',
  rules: [
    {
      required: true,
      message: '量表英文名称是必填项！',
      trigger: 'blur',
    },
  ],
};

const scaleShortNameCNItem: InputItem = {
  name: 'input',
  prop: 'shortNameCN',
  label: '中文简称',
  placeholder: '请输入量表中文简称',
  defaultValue: '',
};

const scaleShortNameENItem: InputItem = {
  name: 'input',
  prop: 'shortNameEN',
  label: '英文简称',
  placeholder: '请输入量表英文简称',
  defaultValue: '',
};

const scaleQuestionNumItem: InputItem = {
  name: 'input',
  prop: 'questionNum',
  label: '题数',
  placeholder: '请输入题数',
  defaultValue: '',
  rules: [
    {
      required: true,
      message: '题数是必填项！',
      trigger: 'change',
    },
  ],
};

const scaleLevelItem: SelectItem = {
  name: 'select',
  prop: 'level',
  label: '级别',
  placeholder: '请选择级别',
  defaultValue: '',
  rules: [
    {
      required: true,
      message: '级别是必填项！',
      trigger: 'change',
    },
  ],
  options: () => [
    { label: 'A', value: 0 },
    { label: 'B', value: 1 },
    { label: 'C', value: 2 },
    { label: 'D', value: 3 },
    { label: 'E', value: 4 },
  ],
};

const scaleTypeItem: SelectItem = {
  name: 'select',
  prop: 'type',
  label: '类型',
  placeholder: '请选择类型',
  defaultValue: '',
  rules: [
    {
      required: true,
      message: '类型是必填项！',
      trigger: 'change',
    },
  ],
  options: () => [
    { label: '青少年', value: 0 },
    { label: '家庭', value: 1 },
    { label: '中老年', value: 2 },
    { label: '职场', value: 3 },
    { label: '其他', value: 4 },
  ],
};

const scaleIsCommonItem: SelectItem = {
  name: 'select',
  prop: 'isCommon',
  label: '是否常用',
  placeholder: '请选择是否常用',
  defaultValue: false,
  rules: [
    {
      required: true,
      message: '是否常用是必填项！',
      trigger: 'change',
    },
  ],
  options: () => [
    { label: '是', value: true },
    { label: '否', value: false },
  ],
};

const scaleAuthorItem: InputItem = {
  name: 'input',
  prop: 'author',
  label: '作者',
  placeholder: '请输入量表作者',
  defaultValue: '',
};

export const scaleFormItems = [
  scaleNameCNItem,
  scaleNameENItem,
  scaleShortNameCNItem,
  scaleShortNameENItem,
  scaleQuestionNumItem,
  scaleLevelItem,
  scaleTypeItem,
  scaleIsCommonItem,
  scaleAuthorItem,
];
